package com.travel.controller;

import com.qianfeng.util.ResultMsg;
import com.travel.entity.TbHomeOrder;
import com.travel.service.HomeOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/adminHomeOrder")
public class AdminHomeOrderController {

    @Autowired
    HomeOrderService homeOrderService;


    /**
     * 查询所有入住订单
     * */
    @GetMapping("/getAll")
    public ResultMsg getAll(){
        return homeOrderService.getAll();
    }

    /**
     * 查询所有入住订单(分页)
     * */
    @GetMapping("/getAllByPage")
    public ResultMsg getAllByPage(Integer current,Integer size){
        return homeOrderService.getAllByPage(current,size);
    }

    /**
     * 通过ID查询单个入住订单
     * */
    @GetMapping("/getOneById")
    public ResultMsg getOneById(Integer homeOrderId){
        return homeOrderService.getOneById(homeOrderId);
    }

    /**
     * 插入单个入住订单
     * */
    @GetMapping("/adminInsertOne")
    public ResultMsg insertOne(TbHomeOrder homeOrder){
        return homeOrderService.insertOne(homeOrder);
    }

    /**
     * 修改单个入住订单
     * */
    @GetMapping("/adminUpdateOne")
    public ResultMsg updateOne(TbHomeOrder homeOrder){
        return homeOrderService.updateOne(homeOrder);
    }

    /**
     * 根据ID删除单个入住订单
     * */
    @GetMapping("/adminDeleteOne")
    public ResultMsg deleteOne(String homeOrderId){
        return homeOrderService.deleteOne(homeOrderId);
    }


}
